!
function(a, b) {
    "function" == typeof define && (define.amd || define.cmd) ? define(function() {
        return b(a)
    }) : b(a, !0)
}(this,
    function(w, flag) {
        function invoke(command, param, _params) {
            w.WebViewJavascriptBridge ? WebViewJavascriptBridge.callHandler(command, param, function(response) {
                dispose(command, response, _params);
            }) : load_error();
        }

        function send() {
            w.WebViewJavascriptBridge ? WebViewJavascriptBridge.send(param, callback(response)) : load_error();
        }

        function dispose(command, response, param) {
            param[response.err_code] && param[response.err_code](response.content);
            param.complete && param.complete(response.content);
        }

        function load_error() {
            alert("WebViewJavascriptBridge 没有加载");
        }
        var MUST;
        MUST = {
                config: function(options) {

                },
                ready: function(callback) {
                    if (w.WebViewJavascriptBridge) {
                        WebViewJavascriptBridge.init(function(message, responseCallback) {
                            var data = { 'Javascript Responds': 'Wee!' };
                            responseCallback(data);
                        });
                        callback();
                    } else {
                        document.addEventListener('WebViewJavascriptBridgeReady', function() {
                            WebViewJavascriptBridge.init(function(message, responseCallback) {
                                var data = { 'Javascript Responds': 'Wee!' };
                                responseCallback(data);
                            });
                            callback();
                        }, false)
                    }
                },
                error: function(param) {

                },
                // 获取openId
                getOpenId: function(param) {
                    invoke("getOpenId", {}, param);
                },
                // 开始录音
                startRecord: function(param) {
                    invoke("startRecord", {}, param);
                },
                // 结束录音
                stopRecord: function(param) {
                    invoke("stopRecord", {}, param);
                },
                // 播放录音
                playVoice: function(param) {
                    invoke("playVoice", { localId: param.localId }, param);
                },
                // 暂停播放
                pauseVoice: function(param) {
                    invoke("pauseVoice", { localId: param.localId }, param);
                },
                // 停止播放
                stopVoice: function(param) {
                    invoke("stopVoice", { localId: param.localId }, param);
                },
                // 上传录音
                uploadVoice: function(param) {
                    invoke("uploadVoice", { localId: param.localId }, param);
                },
                // 下载录音
                downloadVoice: function(param) {
                    invoke("downloadVoice", { serverId: param.serverId }, param);
                },
                // 选择图片
                chooseImage: function(param) {
                    invoke("chooseImage", { scene: "1|2", count: param.count || 9, sizeType: param.sizeType || ["original", "compressed"], sourceType: param.sourceType || ["album", "camera"], watermark: param.watermark }, param);
                },
                // 预览图片
                previewImage: function(param) {
                    invoke("previewImage", { current: param.current, urls: param.urls }, param);
                },
                // 上传图片
                uploadImage: function(param) {
                    invoke("uploadImage", { localId: param.localId }, param);
                },
                // 下载图片
                downloadImage: function(param) {
                    invoke("downloadImage", { serverId: param.serverId }, param);
                },
                // 获取网络类型
                getNetworkType: function(param) {
                    invoke("getNetworkType", {}, param);
                },
                // 打开地理位置
                openLocation: function(param) {
                    invoke("openLocation", {
                            latitude: param.latitude,
                            longitude: param.longitude,
                            name: param.name || "",
                            address: param.address || "",
                            scale: param.scale || 28,
                            infoUrl: param.infoUrl || ""
                        },
                        param);
                },
                // 获取地理位置
                getLocation: function(param) {
                    param = param || {},
                        invoke("getLocation", { type: param.type || "wgs84" }, param);
                },
                // 隐藏菜单
                hideOptionMenu: function(param) {
                    invoke("hideOptionMenu", {}, param);
                },
                // 显示菜单
                showOptionMenu: function(param) {
                    invoke("showOptionMenu", {}, param);
                },
                // 隐藏loading
                hideLoading: function(param) {
                    param = param || {},
                    invoke("hideLoading", {}, param);
                },
                // 显示loading
                showLoading: function(param) {
                    param = param || {},
                    invoke("showLoading", {message:param.message,overtime:param.overtime || ""}, param);
                },
                // 关闭网页窗口
                closeWindow: function(param) {
                    param = param || {},
                        invoke("closeWindow", {
                                immediate_close: param.immediateClose || 0
                            },
                            param);
                },
                // 隐藏菜单项
                hideMenuItems: function(param) {
                    invoke("hideMenuItems", {
                            menuList: param.menuList
                        },
                        param);
                },
                // 显示菜单项
                showMenuItems: function(param) {
                    invoke("showMenuItems", {
                            menuList: param.menuList
                        },
                        param);
                },
                // 隐藏所有菜单
                hideAllNonBaseMenuItem: function(param) {
                    invoke("hideAllNonBaseMenuItem", {}, param);
                },
                // 显示所有菜单
                showAllNonBaseMenuItem: function(param) {
                    invoke("showAllNonBaseMenuItem", {}, param);
                },
                // 扫码
                scanQRCode: function(param) {
                    param = param || {},
                        invoke("scanQRCode", {
                                needResult: param.needResult || 0,
                                scanType: param.scanType || ["qrCode", "barCode"]
                            },
                            param);
                },
                // 文件预览
                filePreview: function(param) {
                    param = param || {url:"",fileType:"",fileName:"",flieSize:""},
                        invoke("filePreview", param, param);
                },
                // 获取时间 
                // param = {pattern : "yyyy-MM-dd"} 
                // 根据参数里的格式 返回时间，可能是日期、时间或日期时间都有
                getDateTime: function(param) {
                    param = param || { pattern: "yyyy-MM-dd", date: new Date().getFullYear() + "-" + (new Date().getMonth() + 1) + "-" + new Date().getDate() },
                        invoke("getDateTime", param, param);
                },
                // 新页面选择项 
                // param = {"options": [{"value": "value1", "name": "name1"},{"value": "value2", "name": "name2"},{"value": "value3", "name": "name3"}], "max" : 2, "min" : 1, "type" : "checkbox"}
                // 如果是checkbox，最大选项数和最少选项数必传
                // 返回选中的options {"options": [{"value": "value1", "name": "name1"}, {"value": "value3", "name": "name3"}]}
                chooseCheckBoxOrRadio: function(param) {
                    param = param || { "options": [], "max": 0, "min": 0 },
                        invoke("chooseCheckBoxOrRadio", param, param);
                },
                // 选择文件
                // param {permission : "private"||"public"} 私有或者公开
                // 返回 文件名
                chooseFile: function(param) {
                    param = param || {},
                        invoke("chooseFile", {}, param);
                },
                // 选择项
                // param = {"options": [{"value": "value1", "name": "name1"},{"value": "value2", "name": "name2"},{"value": "value3", "name": "name3"}]}
                // 如果是checkbox，最大选项数和最少选项数必传
                // 返回选中的options {"options": [{"value": "value1", "name": "name1"}, {"value": "value3", "name": "name3"}]}
                chooseSelect: function(param) {
                    param = param || { "options": [] },
                        invoke("chooseSelect", param, param);
                },
                //选择关联数据
                //type = checkbox || radio
                chooseRefObj: function(param) {
                    param = param || { url:"" , keywords:"" , pagesize:20 , pageno:1,type:"" },
                        invoke("chooseRefObj", param, param);
                }
            },
            flag && (w.must = w.MUST = MUST),
            MUST
    });